#3D折线图，表示日本，美国，印度的疫情状况
import math

from pyecharts.options import TitleOpts, LegendOpts, ToolboxOpts

from 练习.zhexian.折线图的数据处理 import *
import pyecharts.options as opts
from pyecharts.charts import Line3D



week_en = "Saturday Friday Thursday Wednesday Tuesday Monday Sunday".split()
clock = (
    "12a 1a 2a 3a 4a 5a 6a 7a 8a 9a 10a 11a 12p "
    "1p 2p 3p 4p 5p 6p 7p 8p 9p 10p 11p".split()
)

data = [[x, y, z] for x, y, z in zip(data_us(), data_ld(), data_jp())]
# data = [    [x, y, z ],
#              [ z, d, f]
#         ]


# data[]
# for x, y, z in zip(x_list, y_list, z_list):
#     data.append([x, y, z])


(
    Line3D()
    .add(
        "3D图表",
        data,
        xaxis3d_opts=opts.Axis3DOpts(data=clock, type_="value",name="美国"),
        yaxis3d_opts=opts.Axis3DOpts(data=week_en, type_="value",name="日本"),
        zaxis3d_opts=opts.Axis3DOpts(data=week_en, type_="value",name="印度"),

        grid3d_opts=opts.Grid3DOpts(width=100, height=100, depth=100),
    )
    .set_global_opts(
        visualmap_opts=opts.VisualMapOpts(
            dimension=2,
            max_=30,
            min_=0,
            range_color=[
                "#313695",
                "#4575b4",
                "#74add1",
                "#abd9e9",
                "#e0f3f8",
                "#ffffbf",
                "#fee090",
                "#fdae61",
                "#f46d43",
                "#d73027",
                "#a50026",
            ],
        ),
        title_opts =TitleOpts(title="2022新冠人数", pos_left='200PX', pos_top='1%'),  # 标题，位置控制
        legend_opts = LegendOpts(is_show=True),  # 图列，表示。is_show=True 是否展示
        toolbox_opts = ToolboxOpts(is_show=True)
# 工具箱，
    )
    .render("line3d_rectangular_projection.html")
)


